<?php
class cyitemModel extends model{
	public $base;
	public function __construct(&$base){
		parent::__construct($base);
		$this->table="cyitem";
	}
	
	public function item_status_list(){
		return array(
			1=>"筹备中",
			2=>"正在运营",
		);
	}
	
	public function id_title($ids){
		if(empty($ids)) return false;
		$t_d=$this->select(array("where"=>" id in("._implode($ids).")","fields"=>"id,title"));
		if($t_d){
			foreach($t_d as $v){
				$data[$v['id']]=$v;
			}
			return $data;
		}
	}
	
	public function getUserList($id){
		
		$join=M("cyitem_join")->select(array("where"=>" cyid=".intval($id)));
		 
		if($join){
			foreach($join as $v){
				$uids[]=$v['userid'];
			}
			return $users=M("user")->getUserByIds($uids);
		}
	}
	
	
	public function getListByIds($ids){
		$option=array(
			"where"=>" id in("._implode($ids).")"
		);
		$data=$this->select($option);
		if($data){
			foreach($data as $k=>$v){
				$t[$v['id']]=$v;
			}
			return $t;
		}
		return false;
	}
	
}

?>